<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>无标题文档</title>
  <link th:href="@{/css/style.css}" rel="stylesheet" type="text/css"/>
  <script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"><span>位置：</span>
  <ul class="placeul">
    <li>营销管理</li>
    <li>客户管理</li>
    <li>修改</li>
  </ul>
</div>
<form action="/erp1/market/customer/editCustom" method="post" class="formbody">
  <div class="formtitle"><span>客户信息</span></div>
  <ul class="forminfo">
    <input name="customid" th:value="${custom.customid}" type="hidden"/>
    <li>
      <label>姓名</label>
      <input name="customname" type="text" th:value="${custom.customname}" class="dfinput"/>
      <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>性别</label>
      <cite>
        <input name="sex" type="radio" value="2" th:checked="${custom.sex==2}"/>男
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input name="sex" type="radio" value="1" th:checked="${custom.sex==1}"/>女
      </cite>
    </li>
    <li>
      <label>所属公司名称</label>
      <input name="company" type="text" th:value="${custom.company}" class="dfinput"/>
      <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>联系方式</label>
      <input name="telephone" type="text" th:value="${custom.telephone}" class="dfinput"/>
      <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>联系地址</label>
      <input name="homeaddress" type="text" th:value="${custom.homeaddress}" class="dfinput"/>
      <i>必填，不能超过130个字符</i>
    </li>
    <li>
      <label>所属区域</label>
      <select class="dfselect" name="pid">
        <option>请选择</option>
        <option th:each="p : ${session.provinces}" th:selected="${p.id==custom.city.pId}" th:value="${p.id}" th:text="${p.pName}">北京</option>
      </select>
      省
      <select name="address" class="dfselect">
        <option>请选择</option>
        <option th:each="c : ${cityList2}" th:selected="${c.id==custom.address}" th:value="${c.id}" th:text="${c.cName}">北京</option>
      </select>
      市
      <i>必选</i>
    </li>
    <script>
      $(function () {
        $("select[name=pid]").change(function () {
          $.ajax({
            url: "/erp1/ajaxCity",
            data: {"pid": $(this).val()},
            dataType: "JSON",
            success: function (data) {
              var city = JSON.parse(data);
              var op = "<option value='0'>请选择城市</option>";
              $.each(city, function (i, e) {
                op += "<option value='" + e.id + "'>" + e.cname + "</option>";
              });
              $("select[name=address]").html("");
              $("select[name=address]").append(op);

            }, error: function () {
              console.log("错误");
            }
          });
        });
      });
    </script>
    <li>
      <label>描述</label>
      <textarea name="distract" th:text="${custom.distract}" class="textinput">阿里巴巴上市公司</textarea>
      <i>可选</i>
    </li>
    <li>
      <label>状态</label>
      <select name="status" class="dfselect">
        <option value="1" th:selected="${custom.status==1}">可用</option>
        <option value="2" th:selected="${custom.status==2}">不可用</option>
      </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input type="text" th:value="${custom.createUser.uname}" readonly="readonly" class="roinput"/>
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input type="text" th:value="${#dates.format(custom.createtime,'yyyy-MM-dd hh:MM:ss')}" readonly="readonly" class="roinput"/>
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input name="" type="submit" class="btn" value="确定"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回"
             onclick="window.history.go(-1);"/>
    </li>
  </ul>
</form>
</body>
</html>